﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using DongleManage.Model.BaseClass;
using System.Data;

namespace DongleManage.Model.Common
{

		
	/// <summary>
	///  计量单位
	/// </summary>
	/// <remarks>
	/// 该实体由工具生成，尽量不要手动修改
	/// </remarks>
	[DataContract]
    public partial class UnitsEntity : BaseEntity
	{
		#region 属性、变量声明
		#region 主属性 --对应数据表主键
		/// <summary>			
		/// 单位编码
		/// </summary>
		/// <remarks>表Units主键</remarks>
        [DisplayName("单位编码")]
		[DataMember]
		public Int32 Code
        {
            get;
            set;
        }
		#endregion
		
		#region 属性
		
		/// <summary>
        /// 单位名称 
		/// </summary>
        [DisplayName("单位名称")]
        [StringLength(64, ErrorMessage = "请勿输入超过 64 个字!")]
        
		[DataMember]
		public String Name
        {
            get;
            set;
        }
		
		/// <summary>
		/// 英文名称 
		/// </summary>
        [DisplayName("英文名称")]
        [StringLength(64, ErrorMessage = "请勿输入超过 64 个字!")]
        
		[DataMember]
		public String EName
        {
            get;
            set;
        }
		
		
		
		/// <summary>
		/// UniqueCode : 国家或有相关的统一编码
		/// </summary>
        [DisplayName("国家或有相关的统一编码")]
        [StringLength(64, ErrorMessage = "请勿输入超过 64 个字!")]
        
		[DataMember]
		public String UniqueCode
        {
            get;
            set;
        }
		#endregion

		#endregion 属性、变量声明
		
	    public UnitsEntity()
        {
            Code = (int)0;
            Name = null;
            EName = null;
            InUserID = (int)0;
            InDate = DateTime.Now;
            EditUserID = (int)0;
            EditDate = DateTime.Now;
            UniqueCode = null;
        }

        public UnitsEntity(IDataReader dataReader)
            : base(dataReader)
        {
            Code = Convert.IsDBNull(dataReader["Code"]) ? 0 : Convert.ToInt32(dataReader["Code"]);
            Name = Convert.IsDBNull(dataReader["Name"]) ? "" : Convert.ToString(dataReader["Name"]);
            EName = Convert.IsDBNull(dataReader["EName"]) ? "" : Convert.ToString(dataReader["EName"]);

            UniqueCode = Convert.IsDBNull(dataReader["UniqueCode"]) ? "" : Convert.ToString(dataReader["UniqueCode"]);
        }
	}
}
